#ifndef  Tui_TAccordion_h
#define  Tui_TAccordion_h




#include "TBase.h"
#include "TButton.h"


class TAccordion :public TPanel{
    
public:
    
    CREATE_FUNC(TAccordion);
    ~TAccordion();
    TAccordion();
    
    static TAccordion* create(xml_node<> * pItem);
    virtual  void initWidthConf(xml_node<> * pItem);
    virtual void onCreateComplete();
    
    TPanel* getCurPanel();
    TButton* getCurTButton();
    void seTAccordionChangeTarget(CCObject*  m_pListener,SEL_MenuHandler    m_pfnSelector);
    void changeTab(int tag);
    void changeIdx(int idx);
    TButton* getBtnByTag(int tag);
protected:
    void layout();
    TPanel* m_pCurPanel;
    TButton* m_pCurBtn;
    CCObject*       m_pListener;
    SEL_MenuHandler    m_pfnSelector;
    vector<TButton*> gBtns;
    vector<TPanel*>  gPanels;
    void onBtnClick(CCObject*);
    void selectBtn(TButton* btn);
    void clear();
};
#endif
